<%@ page language="java" pageEncoding="UTF-8"%>
<%@include file="/global/global-head.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>吉车惠后台管理系统</title>
	<%@include file="/global/global-other.jsp" %>
<script type="text/javascript">
	$(function() {
		submitForm = function($dialog,$grid){
			var oilsName = $('#oilsCode').combobox('getText');
			$("#oilsName").val(oilsName);
			$('#an_car_form').form('submit',{
				url:'${ctx}/bn/oils/insert',
				queryParams:{_m:'exec'},
				onSubmit:function(){
					if($(this).form('enableValidation').form('validate')){
						return true;
					}else{
						return false;
					}
				},
				success:function(data){
					var json =  eval("(" +data+ ")");
					var errcode = json.errcode;
					var errmsg = json.errmsg;
					if(errcode == '1'){
						$.messager.alert("提示",errmsg,"error");
					}else{
						$.messager.alert("提示","保存成功！","info",function(){
							$dialog.dialog('destroy');
							$grid.datagrid('reload');
						});
					}
				}
			});
		};
	});
</script>
	<script type="text/javascript">
	$(function () {
		$("#oilCompanyCode").combobox({
			onChange: function () {
				var newPtion = $(this).combobox('getValue');
				if(newPtion == ""){
					return;
				}
				$('#oilStationId').combobox({
					url:'${ctx}/bn/oil/getStation?oilCompanyCode='+newPtion+'&_m=showStation',
					valueField:'oilStationId',
					textField:'oilStationName'
				});

			}
		})
	})
	</script>
</head>
<body>
<div class="form-box">
	<div class="form-body">
		<form role="form" name="an_car_form" id="an_car_form" class="easyui-form form form-horizontal" data-options="novalidate:true" method="post">
			<div class="seg-title">
				<div class="seg-title-box">
					<ul>
						<li class="seg-title-box-icon" ><img src="${ctx }/assets/images/communication.gif"/></li>
						<li class="seg-title-box-text">基本信息</li>
						<input type="hidden" id="oilsName" name="oilsName" value="">
					</ul>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">
					<p class="label-txt">石油公司：</p>
					<p class="star">*</p>
				</label>
				<div class="col-sm-3">
					<input type="text"  id="oilCompanyCode" name="oilCompanyCode" class="form-control easyui-combobox" style="width:100%;height:34px;line-height:34px;" data-options="valueField: 'code',textField: 'name',url:'${ctx}/tcode/all/method?method=getCacheCdOilCompanies',editable:false" required="required" ></input>
				</div>
				<label class="col-sm-3 control-label">
					<p class="label-txt">加油站：</p>
					<p class="star">*</p>
				</label>
				<div class="col-sm-3">
					<input   id="oilStationId" name="oilStationId"  class="form-control easyui-combobox" style="width:100%;height:34px;line-height:34px;" data-options="valueField: 'oilStationId',textField: 'oilStationName'" ></input>
				</div>

			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">
					<p class="label-txt">油品：</p>
					<p class="star">*</p>
				</label>
				<div class="col-sm-3">
					<input type="text"  id="oilsCode" name="oilsCode"  class="form-control easyui-combobox" style="width:100%;height:34px;line-height:34px;" data-options="valueField: 'code',textField: 'name',url:'${ctx}/tcode/all/method?method=getCacheCdOilModel',editable:false" required="required"></input>
				</div>
				<label class="col-sm-3 control-label">
					<p class="label-txt">价格：</p>
					<p class="star">*</p>
				</label>
				<div class="col-sm-3">
					<input type="text" id="price" name="price" class="form-control easyui-validatebox" style="width:100%;height:34px;line-height:34px;" required="required" validType="checkFloat">
				</div>

			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">
					<p class="label-txt">优惠价格：</p>
					<p class="star">*</p>
				</label>
				<div class="col-sm-3">
					<input type="text" id="privilegePrice" name="privilegePrice" class="form-control easyui-validatebox" style="width:100%;height:34px;line-height:34px;" required="required" validType="length[1,7]">
				</div>
				<label class="col-sm-3 control-label">
					<p class="label-txt">描述：</p>
					<p class="star">*</p>
				</label>
				<div class="col-sm-3">
					<input type="text" id="des" name="des"  class="form-control easyui-validatebox" style="width:100%;height:34px;line-height:34px;"  validType="length[1,50]" >
				</div>
			</div>
		</form>
	</div>
</div>
</body>
</html>